//
//  ViewController.m
//  MSLNews
//
//  Created by lirenqiang on 16/6/12.
//  Copyright © 2016年 lirenqiang. All rights reserved.
//

#import "ViewController.h"
#import "MSLChannelView.h"
#import "MSLNewsMainView.h"


@interface ViewController ()



@end

@implementation ViewController {
    MSLChannelView * _channelView;
    MSLNewsMainView * _newsMainView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupChannelView];
    
    [self setupNewsMainView];
    
}

- (void)setupChannelView {
    UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc] init];
    layout.itemSize = CGSizeMake(80, 35);
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    layout.sectionInset = UIEdgeInsetsMake(0, 10, 0, 10);
    
    _channelView = [[MSLChannelView alloc] initWithFrame:CGRectMake(0, 20, kSCREENWIDTH, 35) collectionViewLayout:layout];
    
    [self.view addSubview:_channelView];
}

- (void)setupNewsMainView {
    
    UICollectionViewFlowLayout * layout = [[UICollectionViewFlowLayout alloc] init];
    layout.minimumLineSpacing = 0;
    layout.minimumInteritemSpacing = 0;
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    _newsMainView = [[MSLNewsMainView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_channelView.frame), kSCREENWIDTH, kSCREENHEIGHT - CGRectGetMaxY(_channelView.frame)) collectionViewLayout:layout];
    
    [self.view addSubview:_newsMainView];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end



















































































































































































